gtkbookmarksmanager: don't allow non valid utf8 in bookmarks
authorCarlos Soriano <csoriano@gnome.org>
Fri, 25 Sep 2015 11:57:24 +0000 (13:57 +0200)
committerCarlos Soriano <csoriano@gnome.org>
Fri, 25 Sep 2015 14:10:32 +0000 (16:10 +0200)
In case some client send to us a non valid utf8 string, don't screw up
the bookmarks file and just return.

https://bugzilla.gnome.org/show_bug.cgi?id=755215

gtk/gtkbookmarksmanager.c

index 7523aed0bb13966f463f1001ce4b288005f03cca..9c3c83652c5a57227eb4a6c44f1e37a1d1aecbcf 100644 (file)
@@ -145,7 +145,7 @@ save_bookmarks (GFile  *bookmarks_file,
 
       g_string_append (contents, uri);
 
-      if (bookmark->label)
+      if (bookmark->label && g_utf8_validate (bookmark->label, -1, NULL))
        g_string_append_printf (contents, " %s", bookmark->label);
 
       g_string_append_c (contents, '\n');